import web
def my_loadhook():
    # webbrowser.open('www.frontarena.com')
    print "my load hook"

def my_unloadhook():
    # 1/0
    print "my unload hook"
    
def my_processor(handler): 
    print 'before handling'
    result = handler() 
    print 'after handling'
    return result




urls = (
  '/', 'index'
)
app = web.application(urls, locals()) #what's the diff between globals and locals here?
# app = web.autoapplication()

# app.add_processor(my_processor)
app.add_processor(web.loadhook(my_loadhook))
app.add_processor(web.unloadhook(my_unloadhook))

## can use DBStore instead, but requires setup of table
#session = web.session.Session(app, web.session.DiskStore('sessions'), initializer={'msg':'hello 22','authenticated':0, 'username':'fred'})






class index:
    def GET(self):
        return '''
Hello
    '''


if __name__ == "__main__":
    print 1100
    app.run()

# print help(app.run)
# Path to this file:
# cd C:\Documents and Settings\merlov01\My Documents\SunGard\Python\owlspace\Tutorials\
# python home.py 8082
# http://localhost:8082 
